## Process this file with autoconf to produce configure.
## In general, the safest way to proceed is to run ./autogen.sh

# make sure we're interpreted by some minimal autoconf
AC_PREREQ([2.59])

AC_INIT([Protocol Buffers Expectation], [0.1], [opensource@google.com], [protobuf-expectation])

# Update this value for every release!  (A:B:C will map to foo.so.(A-C).C.B)
# http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
SO_VERSION=0:0:0

# The argument here is just something that should be in the current directory
# (for sanity checking)
AC_CONFIG_SRCDIR([README])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE
AM_CONFIG_HEADER([src/config.h])

# Checks for programs.
AC_PROG_CC
AC_PROG_CPP
AC_PROG_CXX
AC_LANG([C++])
AM_CONDITIONAL(GCC, test "$GCC" = yes)   # let the Makefile know if we're gcc

AC_PROG_LIBTOOL
AC_SUBST(LIBTOOL_DEPS)
AC_SUBST(SO_VERSION)
AM_CONDITIONAL(USE_LIBTOOL, test "x$LIBTOOL" != "x")

# Check whether some low-level functions/files are available
AC_HEADER_STDC

# Check whether required modules/libraries/tools are available
PKG_CHECK_MODULES(PROTOBUF, protobuf)
AC_PATH_PROG(PROTOC, protoc, [AC_MSG_ERROR([protoc not found])])

PKG_CHECK_MODULES(GFLAGS, libgflags)
PKG_CHECK_MODULES(GLOG, libglog)

AC_CHECK_HEADERS([re2/re2.h], , [AC_MSG_ERROR([re2 not found])])

# HACK:  Make gtest's configure script pick up our copy of CFLAGS and CXXFLAGS
export CFLAGS
export CXXFLAGS
AC_CONFIG_SUBDIRS([gtest])

# Write generated configuration file
AC_CONFIG_FILES([Makefile src/Makefile protobuf-expectation.pc])
AC_OUTPUT
